﻿/*
 * CSTPNode
 * 
 * initial implementation : 20.11.2008
 *
 * Copyright (c) Adam Sida, asida@centrum.cz.
 * All rights reserved.
 * 
 * for license see Petra.Gis.License.txt
 */
using System;
using System.Collections.Generic;
using Petra.Gis.ReferenceSystemServices.Transformations;


namespace Petra.Gis.Support
{


  /// <summary>
  /// coordinate system transformation path node is helper structure
  /// that keeps temporary values during search for transformation
  /// between source CS and target CS
  /// </summary>
  internal class CSTPNode : IComparable<CSTPNode>
  {

    CSTPNode _parent;

    public int Level
    {
      get
      {
        if (_parent != null)
          return _parent.Level + 1;
        else
          return 0;
      }
    }


    public CSTPNode Parent
    {
      get { return _parent; }
    }

    public CSTPNode(CSTPNode parent, SRSTransform currTransform)
    {
      _parent = parent;
      transform = currTransform;
    }

    public SRSTransform transform;

    public List<CSTPNode> childs = new List<CSTPNode>();



    public int CompareTo(CSTPNode other)
    {
      if (this.Level < other.Level)
        return -1;
      else if (this.Level == other.Level)
        return 0;
      else
        return 1;
    }

  }
}
